﻿<%@ Page Language="C#" MasterPageFile="~/TeamManager.Master" AutoEventWireup="true" CodeBehind="Assignment.aspx.cs" Inherits="NWS.Games.Assignment" Title="Entity assignment" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="BodyContentPlaceHolder" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
				</asp:ScriptManager>
			<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
			</telerik:RadAjaxManager>
			<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
				Width="75px" >
				<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
					style="border: 0px;" />
			</telerik:RadAjaxLoadingPanel>
			<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="100%" 
				Width="100%" HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1">
				<table style="width:100%;">
			<tr>
				<td valign="top">
				<table>
				<tr>
				<td>
				<telerik:RadToolBar ID="TreeToolbar" Runat="server" Skin="Office2007" 
						onbuttonclick="TreeToolbar_ButtonClick" >
					<collapseanimation duration="200" type="OutQuint" />
					<Items>
						<telerik:RadToolBarButton runat="server" Text="Remove" CommandName="Remove">
						</telerik:RadToolBarButton>
						<telerik:RadToolBarButton runat="server" Text="Up">
						</telerik:RadToolBarButton>
						<telerik:RadToolBarButton runat="server" Text="Down">
						</telerik:RadToolBarButton>
						<telerik:RadToolBarButton runat="server" Text="Left">
						</telerik:RadToolBarButton>
						<telerik:RadToolBarButton runat="server" Text="Right">
						</telerik:RadToolBarButton>
						<telerik:RadToolBarButton runat="server" CommandName="Excel" 
							Text="Export Excel">
						</telerik:RadToolBarButton>
						<telerik:RadToolBarButton runat="server" CommandName="Word" Text="Export Word">
						</telerik:RadToolBarButton>
					</Items>
					</telerik:RadToolBar>
					</td>
			</tr>
				<tr>
				<td>
    	<telerik:RadTreeView ID="AssignmentTreeView" Runat="server" DataFieldID="EntityID" 
						DataFieldParentID="ParentID" DataSourceID="GameEntitiesDataSource" 
						DataTextField="Name" DataValueField="EntityID" EnableDragAndDrop="True" 
						EnableDragAndDropBetweenNodes="True" Skin="Office2007" Height="100%" 
						onnodedrop="AssignmentTreeView_NodeDrop" Width="400px" 
						onnodedatabound="AssignmentTreeView_NodeDataBound" >
			</telerik:RadTreeView>
					</td>
			</tr>
			</table>
			</td>
				<td valign="top">
								<telerik:RadGrid ID="RemainedGrid" runat="server" 
									DataSourceID="TeamEntitiesDataSource" GridLines="None" AutoGenerateColumns="False" 
									Skin="Office2007" onitemcommand="remainedGrid_ItemCommand" ShowGroupPanel="True">
									<HeaderContextMenu>
										<CollapseAnimation Duration="200" Type="OutQuint" />
									</HeaderContextMenu>
									<MasterTableView 
										DataSourceID="TeamEntitiesDataSource" DataKeyNames="ID">
										<RowIndicatorColumn>
											<HeaderStyle Width="20px" />
										</RowIndicatorColumn>
										<ExpandCollapseColumn>
											<HeaderStyle Width="20px" />
										</ExpandCollapseColumn>
										<Columns>
											<telerik:GridBoundColumn DataField="Name" HeaderText="Name" 
												SortExpression="Name" UniqueName="Name">
											</telerik:GridBoundColumn>
											<telerik:GridBoundColumn DataField="Description" HeaderText="Description" 
												SortExpression="Description" UniqueName="Description">
											</telerik:GridBoundColumn>
											<telerik:GridBoundColumn DataField="EntityTypeName" HeaderText="Entity Type" 
												SortExpression="EntityTypeName" UniqueName="EntityTypeName">
											</telerik:GridBoundColumn>
											<telerik:GridButtonColumn CommandName="AddChild" Text="Add Child" 
												UniqueName="column">
											</telerik:GridButtonColumn>
											<telerik:GridButtonColumn CommandName="AddAfter" Text="Add below" 
												UniqueName="column1">
											</telerik:GridButtonColumn>
											<telerik:GridButtonColumn CommandName="AddBefore" Text="Add above" 
												UniqueName="column2">
											</telerik:GridButtonColumn>
										</Columns>
									</MasterTableView>
									<groupingsettings groupbyfieldsseparator="EntityTypeName; " />
									<ClientSettings allowdragtogroup="True">
										<Selecting AllowRowSelect="True" />
									</ClientSettings>
									<FilterMenu>
										<CollapseAnimation Duration="200" Type="OutQuint" />
									</FilterMenu>
			</telerik:RadGrid>
			</td>
			</tr>
		</table>
			</telerik:RadAjaxPanel>
    </div>
      <asp:ObjectDataSource ID="TeamEntitiesDataSource" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetUnusedGameEntities" 
        TypeName="Dzzzr.GameEntityController">
        <SelectParameters>
          <asp:QueryStringParameter DefaultValue="1" Name="gameID" 
						QueryStringField="GameID" Type="Int32" />
        </SelectParameters>
      </asp:ObjectDataSource>
      <asp:ObjectDataSource ID="GameEntitiesDataSource" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetUsedGameEntities" 
        TypeName="Dzzzr.GameEntityController">
        <SelectParameters>
          <asp:QueryStringParameter DefaultValue="1" Name="gameID" 
						QueryStringField="GameID" Type="Int32" />
        </SelectParameters>
      </asp:ObjectDataSource>
    </asp:Content>
